<script src="//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
<script type="text/javascript">

$.get("http://ipinfo.io", function (response) {
    $("#ip").html("IP: " + response.ip);
    $("#address").html("Location: " + response.city + ", " + response.region);
    $("#details").html(JSON.stringify(response, null, 4));
    $("#city").html(response.city + ", " + response.country);
    $("#loc").html(response.loc);
    var result = response.loc.split(",");
    var lat = result[0];
    var lon = result[1];
    document.getElementById('city').value = response.city;

    $.get("http://api.openweathermap.org/data/2.5/weather?lat="+lat+"&lon="+lon+"&units=metric&appid=6fe49f5ee6dd7ff81e5bc5404d93920b", function (wdata) {
      var temp = (wdata.main.temp);
      var weather = (wdata.weather[0].main);
      $("#temp").html(temp + "°C");
    });

}, "jsonp");
</script>

<div class="weather_forecast">
  <i class="wi wi-day-cloudy"></i>
  <span class="city" id="city"></span>
  <span class="temp" id="temp"></span>
</div><!-- End Weather forecast -->
